package cn.edu.nchu.comic_strip;

import android.app.Application;

import cn.edu.nchu.comic_strip.database.AppDatabase;

/**
 * @className: App
 * @description: TODO 类描述
 * @author: Kuangkeli
 * @date: 2024/05/24 17:52
 **/
public class App extends Application {

    private static App app;
    private static AppDatabase appDatabase;

    @Override
    public void onCreate() {
        super.onCreate();
        app = this;
        appDatabase = AppDatabase.getDatabase(this);
        // 创建数据库表
        appDatabase.getOpenHelper().getWritableDatabase();
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
        appDatabase.close();
    }

    public static App getApp() {
        return app;
    }

    public static AppDatabase getAppDatabase() {
        return appDatabase;
    }
}
